Sub ParameterPrint()
Dim cmd1 As ADODB.Command
Dim rst1 As ADODB.Recordset
Dim str1 As String
Dim fld1 As ADODB.Field
Dim prm1 As ADODB.Parameter
Dim int1 As Integer

'Specify a command, then execute it
Set cmd1 = New ADODB.Command
With cmd1
   .ActiveConnection = CurrentProject.Connection
   .CommandText = "Parameters [IDNUM] Long;" & _
        "SELECT MemberID, FirstName, LastName, Email " & _
        "FROM MEMBERS " & _
        "WHERE MemberID = [IDNUM]"
   .CommandType = adCmdText
End With

'Create the parameter, and then accept user input
Set prm1 = cmd1.CreateParameter("[IDNUM]", _
     adInteger, adParamInput)
cmd1.Parameters.Append prm1
int1 = Trim(InputBox("Enter MemberID:"))
prm1.Value = int1

'Set rst1 to the recordset returned by the command,
'then print the recordset
Set rst1 = cmd1.Execute
Do Until rst1.EOF
     str1 = ""
     For Each fld1 In rst1.Fields
          str1 = str1 & fld1.Value & vbTab
     Next fld1
     Debug.Print str1
     rst1.MoveNext
Loop

'Clean up before exiting
rst1.Close
Set fld1 = Nothing
Set rst1 = Nothing
Set cmd1 = Nothing

End Sub
